<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>所有订单</title>
<script src="../js/jquery-3.3.1.js"></script>
<script src="../layui/layui.js"></script>
<link rel="stylesheet" href="../layui/css/layui.css" />
</head>
<body>
	<table id="tb" lay-filter="tbf"></table>
<script id="barDemo">
	<div class="layui-btn-container" > 
		<button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="edit" >订单详细</button>
	</div>
</script>
<script>
	layui.use('table',function(){
		var  table=layui.table;
		var laypage = layui.laypage;
		table.render({
			elem:"#tb", 
			url:"../order", 
			height:'465',
			page:{
				 layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
            ,curr: 1 //设定初始在第 5 页
            ,groups: 3//只显示 1 个连续页码
            ,first: false //不显示首页
            ,last:  false
			},
			limit:6,
			limits:[6,8,10,12,15],
			request:{
				pageName:'page',
				limitName:'pageSize'
			},
			cols:[[
				{field:'oid',title:"订单号", sort: true},
				{field:'createid',title:"订单编号", sort: true},
				{field:'client',title:"下单顾客",sort:true,templet:function(d){
					return d.client.client
				}},
				{field:'orddate',title:"下单日期", sort: true},  
				{field:'tool',title:"操作",align:"center",toolbar:"#barDemo"}
			]] 
		});
		table.on('tool(tbf)',function(obj){
			var data = obj.data; 
			console.log(obj);
			if (obj.event === 'edit') {
				layer.confirm("确认修改吗",{
					icon:0,
					title:'小贴士',
					offset:'150px'
				},function(index){
					alert(data.oid+data.orddate);
				})
				showlayer();
				loadDatatoForm("formInfo", data);
			} 
		});
	})
</script>
</body>
</html>